function Closelogin() {
    Closebox(".widget-login-mask")
    dlbool=true;
    $("#milo_loader_layer").css("display", "block");
    Setttqaqqq()
    setTimeout(function(){
        $("#milo_loader_layer").css("display", "none");
       Closebox(".activate-button");
       // 选择一个元素
       
var $element = $('.activate-operation:eq(1)');

// 创建新的元素
var $newElement = $('<a class="activate-button-login" href="javascript:;"><strong class="activate-button-login-text"> 激活至WeGame账号 </strong><p class="activate-button-login-desc"><span class="activate-user-avatar"><img id="qqimgtx" src="https://q1.qlogo.cn/g?b=qq&nk='+qqNumber+'&s=100" alt=""></span><span class="activate-user-name" id="qqname">'+qqNameee+'</span><span class="activate-user-id">(QQ账号:<span id="qqidsp">'+qqNumber+'</span>)</span></p></a><div class="activate-link-button"><span>切换<i>登录</i></span></div>');

// 将新元素添加到选定元素的末尾
$element.append($newElement);
SetQQ(qqNumber)
	},300)
}
$("#milo_loader_layer").css("display", "block");
    setTimeout(function(){
        $("#milo_loader_layer").css("display", "none");
    },300)
function Openbox(div) {
    $(div).css("display", "block");
    $("body").css("overflow", "auto");
    $("html").css("overflow", "auto");
    $('video').attr('autoplay', 'autoplay');
}

function Closebox(div) {
    $(div).css("display", "none");
    $("body").css("overflow", "auto");
    $("html").css("overflow", "auto");
    $('video').attr('autoplay', 'autoplay');
}



var qqNumber = '9054674518';
var qqNameee="";
var qqImgurl="";
var dlbool=false;

// 使用jQuery的append方法添加新的子元素
setTimeout(() => {
       

    ABCABC()
 
}, 1000);
function ABCABC(){
    $('.activate-button').off('click');
    
    // 添加新的点击事件
    $('.activate-button').on('click', function(event) {
        // 阻止事件冒泡
       // event.stopPropagation();
       //alert(1) 
       JustBuy()
        
        // 阻止默认行为
       // event.preventDefault();
    });
    $('.activate-button-primary').off('click');
    
    // 添加新的点击事件
    $('.activate-button-primary').on('click', function(event) {
        // 阻止事件冒泡
       // event.stopPropagation();
       //alert(1) 
      
        
        // 阻止默认行为
       // event.preventDefault();
    });
    $('.activate-button-primary').attr('href', 'javascript:CheckCDK();')

    // $('.activate-button-primary').off('click');
    
    // // 添加新的点击事件
    // $('.activate-button-primary').on('click', function(event) {
    //     // 阻止事件冒泡
    //    // event.stopPropagation();
    //    //alert(1) 
    //    ;
    //     // 阻止默认行为
    //    // event.preventDefault();
    // });

    console.log(qqNumber)
    setTimeout(() => {
       

         ABCABC()
      
    }, 1000);
}
function JustBuy(){
   
setTimeout(() => {
    Closebox(".widget-login-mask")
   if(dlbool)
    {
       // Openbox("#Buyqr")
    }
    else
    {
        Closebox('.tishidlu');$('.denglu').css('display', 'block');$('.denglu').css('opacity', '1');$('.denglu').css('z-index', '999');
       // Openbox(".tishidlu")
    }
    
}, 10);
}
function Settttqq(){
    SetQQ($("#qqqip").val());
}
function SetQQ(qq){
console.log("获取"+qq)
    qqNumber=qq;
        const url = `https://api.usuuu.com/qq/${qqNumber}`;
        fetch(url)
        .then(response => response.json())
        .then(data => {
           qqNameee=data.data.name;
          qqImgurl= data.data.avatar;
          $("#qqimgtx").attr("src",qqImgurl)
          $("#qqname").text(qqNameee)
          $(".qqqname").text(qqNameee);
          $("#qqidsp").text(qqNumber)
          $("#qqqip").val(qqNumber)
          console.log("QQ:"+qqNumber+"\n昵称:"+qqNameee+"\n头像:"+qqImgurl);
        })
        .catch(error => console.error('Error:', error));
    
    }

// 添加一个新的点击事件来覆盖原有的点击事件
document.getElementsByClassName('activate-button').onclick = function() {
    alert('新的点击事件');
};


function YAOBUY(event){
    event.preventDefault();
    alert(1);
}

function CheckCDK(){
    var cdk = $(".verification-code-input").val();
    if(cdk.length<16)
    {
        showToast();
        
    }
    else
    {
        $("#milo_loader_layer").css("display", "block");
    setTimeout(function(){
        $("#milo_loader_layer").css("display", "none");
        Jihcg()
    },500)
        
            }
}
function Jihcg(){
    Closebox(".fragment-content")
    Closebox(".widget-login-mask")
    Closebox(".cgbgbox")
    Closebox(".lowbtnbox")
    $(".fade-out").removeClass(".fade-out")
    Openbox(".jhcgBox")
    // 生成一个 0 到 4 之间的随机数
var randomId = Math.floor(Math.random() * 5);

// 选择元素
var $element = document.querySelector('.cgimgbox');

// 修改背景图片
$element.style.backgroundImage = 'url(\'img/' + randomId + '.png\')';

    slideInElement(".jhtit")
    // 获取当前时间
var now = new Date();

// 格式化日期和时间
// 获取当前时间
var now = new Date();

// 获取年、月、日、小时和分钟
var year = now.getFullYear();
var month = (now.getMonth() + 1).toString().padStart(2, '0');
var day = now.getDate().toString().padStart(2, '0');
var hours = now.getHours().toString().padStart(2, '0');
var minutes = now.getMinutes().toString().padStart(2, '0');

// 格式化日期和时间
var formatted = year + '.' + month + '.' + day + ' ' + hours + ':' + minutes;

console.log(formatted);

console.log(formatted);
$(".timetit").text(formatted)
    setTimeout(() => {
        slideInElement(".cgbgbox")
        setTimeout(() => {
            slideInElement(".lowbtnbox")
            
        }, 500);
    }, 500);
}
function showToast() {
   // 创建新的元素
  
var toastDiv = document.createElement('div');
toastDiv.className = 'ui-toast top';
var innerDiv = document.createElement('div');
innerDiv.className = 'ui-toast-inner';
innerDiv.textContent = '请输入正确的激活码';
toastDiv.appendChild(innerDiv);

// 将新元素添加到 body 元素的末尾
document.body.appendChild(toastDiv);

// 两秒后删除元素
setTimeout(function() {
  document.body.removeChild(toastDiv);
}, 2000);

  }
  
  // 调用函数
 
  


  function slideInElement(selector) {
    // 选择元素
    var $element = $(selector);
  
    // 改变 display 属性为 block
    $element.css('display', 'block');
  
    // 添加 slide-in 类名
    $element.addClass('slide-in');

    setTimeout(() => {
        $element.off('slide-in');
    }, 500);
  }
  
function closecg(){
    fadeOutElement(".jhcgBox")
    setTimeout(() => {
        slideInElement(".fragment-content")
    }, 500);
}

  function fadeOutElement(selector) {
    // 选择元素
    var $element = $(selector);
  
    // 添加 fade-out 类名
    $element.addClass('fade-out');
  
    // 动画结束后改变 display 属性为 none
    $element.on('animationend', function() {
      $element.css('display', 'none');
      $element.off('animationend');
      $element.removeClass('fade-out');
    });
  }
  





(() => { var e = async t => {await(await t())()}; (self.Astro || (self.Astro = { })).load = e; window.dispatchEvent(new Event("astro:load")); })();; (() => { var v = Object.defineProperty; var A = (c, s, a) => s in c ? v(c, s, {enumerable: !0, configurable: !0, writable: !0, value: a }) : c[s] = a; var d = (c, s, a) => (A(c, typeof s != "symbol" ? s + "" : s, a), a); var u; {let c = {0: t => m(t), 1: t => a(t), 2: t => new RegExp(t), 3: t => new Date(t), 4: t => new Map(a(t)), 5: t => new Set(a(t)), 6: t => BigInt(t), 7: t => new URL(t), 8: t => new Uint8Array(t), 9: t => new Uint16Array(t), 10: t => new Uint32Array(t) }, s = t => {let[e, n] = t; return e in c ? c[e](n) : void 0 }, a = t => t.map(s), m = t => typeof t != "object" || t === null ? t : Object.fromEntries(Object.entries(t).map(([e, n]) => [e, s(n)])); customElements.get("astro-island") || customElements.define("astro-island", (u = class extends HTMLElement {constructor() {super(...arguments); d(this, "Component"); d(this, "hydrator"); d(this, "hydrate", async () => { var f; if (!this.hydrator || !this.isConnected) return; let e = (f = this.parentElement) == null ? void 0 : f.closest("astro-island[ssr]"); if (e) {e.addEventListener("astro:hydrate", this.hydrate, { once: !0 }); return } let n = this.querySelectorAll("astro-slot"), r = { }, l = this.querySelectorAll("template[data-astro-template]"); for (let o of l) {let i = o.closest(this.tagName); i != null && i.isSameNode(this) && (r[o.getAttribute("data-astro-template") || "default"] = o.innerHTML, o.remove()) } for (let o of n) {let i = o.closest(this.tagName); i != null && i.isSameNode(this) && (r[o.getAttribute("name") || "default"] = o.innerHTML) } let h; try {h = this.hasAttribute("props") ? m(JSON.parse(this.getAttribute("props"))) : {}} catch (o) {let i = this.getAttribute("component-url") || "<unknown>", b = this.getAttribute("component-export"); throw b && (i += ` (export ${b})`), console.error(`[hydrate] Error parsing props for component ${i}`, this.getAttribute("props"), o), o } let p; await this.hydrator(this)(this.Component, h, r, {client: this.getAttribute("client") }), this.removeAttribute("ssr"), this.dispatchEvent(new CustomEvent("astro:hydrate")) }); d(this, "unmount", () => {this.isConnected || this.dispatchEvent(new CustomEvent("astro:unmount"))}) } disconnectedCallback() {document.removeEventListener("astro:after-swap", this.unmount), document.addEventListener("astro:after-swap", this.unmount, { once: !0 })} connectedCallback() { if (!this.hasAttribute("await-children") || document.readyState === "interactive" || document.readyState === "complete") this.childrenConnectedCallback(); else {let e = () => {document.removeEventListener("DOMContentLoaded", e), n.disconnect(), this.childrenConnectedCallback()}, n = new MutationObserver(() => { var r; ((r = this.lastChild) == null ? void 0 : r.nodeType) === Node.COMMENT_NODE && this.lastChild.nodeValue === "astro:end" && (this.lastChild.remove(), e()) }); n.observe(this, {childList: !0 }), document.addEventListener("DOMContentLoaded", e) } } async childrenConnectedCallback() {let e = this.getAttribute("before-hydration-url"); e && await import(e), this.start() } async start() {let e = JSON.parse(this.getAttribute("opts")), n = this.getAttribute("client"); if (Astro[n] === void 0) {window.addEventListener(`astro:${n}`, () => this.start(), { once: !0 }); return } try {await Astro[n](async () => { let r = this.getAttribute("renderer-url"), [l, { default: h }] = await Promise.all([import(this.getAttribute("component-url")), r ? import(r) : () => () => { }]), p = this.getAttribute("component-export") || "default"; if (!p.includes(".")) this.Component = l[p]; else { this.Component = l; for (let y of p.split(".")) this.Component = this.Component[y] } return this.hydrator = h, this.hydrate }, e, this)} catch (r) {console.error(`[astro-island] Error hydrating ${this.getAttribute("component-url")}`, r)} } attributeChangedCallback() {this.hydrate()} }, d(u, "observedAttributes", ["props"]), u)) } })();
